package daohibernate;

import hibernate.HibernateUtil;

import org.hibernate.Session;
import org.hibernate.SessionFactory;

import entities.ProServ;

public class ProServDAO {
	private static ProServDAO instancia = null;
	@SuppressWarnings("unused")
	private static SessionFactory sf = null;	
	
	public static ProServDAO getInstancia(){
		if(instancia == null){
			sf = HibernateUtil.getSessionFactory();
			instancia = new ProServDAO();
		} 
		return instancia;
	}
	
	
	public void altaProServ(ProServ r){
		Session s = HibernateUtil.getSessionFactory().openSession();
		s.beginTransaction();
		s.persist(r);
		s.flush();
		s.getTransaction().commit();
		s.close();
	}
}
